<template>
  <van-picker :columns="items" />
</template>
<script setup lang="ts">
import { reactive } from "vue";
import { dictMapCache } from "@/api/dict/index";
import type { AntEntry } from "@/api/types";

const props = defineProps({
  typeCode: {
    type: String,
    default: ""
  },
  enable: {
    type: Boolean,
    default: true
  }
});
const items = reactive([] as AntEntry[]);

dictMapCache(props.typeCode, props.enable).then((res) => {
  res.forEach((dict) => {
    items.push({ value: dict.dictCode, text: dict.dictName });
  });
});
</script>
